package com.gxa.insurance.controller;

import com.gxa.insurance.exception.BusinessException;
import com.gxa.insurance.pojo.EtcApply;
import com.gxa.insurance.pojo.ThirdAdmin;
import com.gxa.insurance.service.EtcApplySevice;
import com.gxa.insurance.util.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
@Api(value = "etc相关接口")
@RestController
@RequestMapping("/etcApply")
@CrossOrigin
public class EtcApplyController {
  @Autowired
    EtcApplySevice etcApplySevice;
    @ApiOperation(value = "ETC数据条请求接口",produces = "query")
    @PostMapping("/DisplayETC")
    public Map display(Integer page,Integer size) throws Exception {
        List<Map<String, Object>> maps = etcApplySevice.selectByPage(page, size);
        JsonResult jsonResult =new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setData(maps);
        return jsonResult.getMap();
    }
    @ApiOperation(value = "ETC查询",produces = "query")
    @PostMapping("/SuchETC")
    public Map Such(String name) throws Exception {
        List<EtcApply> etcApplies = etcApplySevice.selectLikeName(name);
        JsonResult jsonResult =new JsonResult();
        jsonResult.setMsg("200");
        jsonResult.setData(etcApplies);
        return jsonResult.getMap();
    }
}
